The Card Verification Value (CVV) is a cryptographic check value derived from specific fields of data, such as account number, card expiration date, service code, and keys (CVKs).
The CVV is written onto the card. During transactions it is sent to the HSM which recalculates the CVV and compares it with the received CVV to confirm the validity of the card.